//
//  ZQStatusPhotoView.m
//  柳州微博
//
//  Created by Apple_Lzzy45 on 16/11/2.
//  Copyright © 2016年 Apple_Lzzy40. All rights reserved.
//

#import "ZQStatusPhotoView.h"
//#import "ZQPicture.h"

@interface ZQStatusPhotoView ()

@property(nonatomic,strong) UIImageView *ZQimage;

@end

@implementation ZQStatusPhotoView
/**
 *  懒加载
 *
 *  @param photo GIF
 */
-(UIImageView *)ZQimage
{
    if (_ZQimage == nil) {
        _ZQimage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"timeline_image_gif"]];
        
        [self addSubview:_ZQimage];
    }
    return _ZQimage;
}
-(instancetype)initWithFrame:(CGRect)frame
{
    self =[super initWithFrame:frame];
    if (self) {
        //内容模式
        self.contentMode =UIViewContentModeScaleAspectFill;
        //裁剪越界内容
          self.clipsToBounds=YES;
    }
    return  self;
}
-(void)setPhoto:(ZQPicture *)photo
{
    _photo = photo;
 [self sd_setImageWithURL:[NSURL URLWithString:photo.thumbnail_pic] placeholderImage:[UIImage imageNamed:@"timeline_image_placeholder"]];

 //判断是否是CIF图片
    if ([photo.thumbnail_pic hasSuffix:@"gif"]) {
        NSLog(@"-----%@",photo.thumbnail_pic);
        //
        self.ZQimage.hidden = NO;
    }
    else
    {
        self.ZQimage.hidden = YES;
    }
    
}
-(void)layoutSubviews
{
    self.ZQimage.x = self.width-_ZQimage.width;
    self.ZQimage.y = self.width-_ZQimage.height;
}
@end
